package org.dxy.middleware.dynamic.thread.pool.application.command.commandhandler;

import lombok.RequiredArgsConstructor;
import org.dxy.middleware.dynamic.thread.pool.domain.command.RegisterThreadPoolCommand;
import org.dxy.middleware.dynamic.thread.pool.domain.model.ThreadPoolAggregate;
import org.dxy.middleware.dynamic.thread.pool.domain.port.IThreadPoolRepository;
import org.springframework.stereotype.Component;

/**
 * @ description:
 * @ author: dxy
 * @ createTime: 2025/9/30 0:08
 */
@Component
@RequiredArgsConstructor
public class RegisterThreadPoolCommandHandler {

    private final IThreadPoolRepository IThreadPoolRepository;


    public void handle(RegisterThreadPoolCommand command) {
        // 1. 注册线程池到领域模型
        ThreadPoolAggregate threadPoolAggregate = ThreadPoolAggregate.register(command);
        IThreadPoolRepository.save(threadPoolAggregate);
    }

}
